import { $post, $get, $uploadImg, $delete, $put } from '../utils/request'

// 分页查询商品列表
export const FIND_SHOP_GOODS_PAGE = (params, pageNo, pageSize) =>
  $post('/store-platform/goods/findGoodsPageApi', params, {
    pageNo,
    pageSize
  })

// 查询单个商品信息
export const FIND_SHOP_GOODS_INFO = (goodsNo) =>
  $get('/store-platform/goods/findGoodsInfoApi', {
    goodsNo
  })

// 上传图片
export const UPLOAD_IMAGE2 = () =>
  $uploadImg('/store-platform/upload-image', 'picFile', {
    picType: 'NORMAL',
    catalog: 'xiaochengxu'
  })

// 查询快递模板列表
export const FIND_SHOP_EXPRESS_TEMPLATE_LIST = (shopId) =>
  $get('/store-platform/express/findListApi', {
    shopId
  })

// 添加快递模板
export const ADD_SHOP_EXPRESS_TEMPLATE = (params) =>
  $post('/store-platform/express/addExpressApi', params)

// 删除快递模板
export const DELETE_SHOP_EXPRESS_TEMPLATE = (expressId) =>
  $delete('/store-platform/express/deleteExpressApi', {
    expressId
  })

// 查询商品类型
export const FIND_SHOP_GOODS_TYPE_LIST = (shopId, parentId) =>
  $get('/store-platform/goodsType/findGoodsTypeListApi', {
    shopId,
    parentId
  })

// 创建商品类型
export const ADD_SHOP_GOODS_TYPE = (params) =>
  $post('/store-platform/goodsType/createGoodsTypeApi', params)

// 删除商品类型
export const DELETE_SHOP_GOODS_TYPE = (goodsTypeId) =>
  $delete('/store-platform/goodsType/deleteGoodsTypeApi', {
    goodsTypeId
  })

// 查询商品规格
export const FIND_SHOP_GOODS_SPECIFICATION_LIST = (goodsNo) =>
  $get('/store-platform/goodsSpec/findGoodsSpecListApi', {
    goodsNo
  })

// 创建商品规格
export const ADD_SHOP_GOODS_SPECIFICATION = (params) =>
  $post('/store-platform/goodsSpec/createGoodsSpecApi', params)

// 删除商品规格
export const DELETE_SHOP_GOODS_SPECIFICATION = (goodsSpecId) =>
  $delete('/store-platform/goodsSpec/deleteGoodsSpecApi', {
    goodsSpecId
  })

// 编辑商品规格
export const UPDATE_SHOP_GOODS_SPECIFICATION = (params) =>
  $put('/store-platform/goodsSpec/updateGoodsSpecApi', params)

// 编辑商品信息
export const UPDATE_SHOP_GOODS_INFO = (params) =>
  $put('/store-platform/goods/updateGoodsApi', params)

// 创建商品
export const ADD_SHOP_GOODS_INFO = (params) =>
  $post('/store-platform/goods/createGoodsApi', params)

// 删除商品
export const DELETE_SHOP_GOODS_INFO = (goodsNo) =>
  $delete('/store-platform/goods/deleteGoodsApi', {
    goodsNo
  })

// 分页查询评价列表
export const ASSESS_FIND_PAGE = (goodsNo, pageNo, pageSize) =>
  $post(
    `/store-platform/assess/findPage?goodsNo=${goodsNo}&pageNo=${pageNo}&pageSize=${pageSize}`
  )

// 查询评价详情
export const ASSESS_FIND_INFO_API = (orderNo) =>
  $get('/store-platform/assess/findInfoApi', {
    orderNo
  })

// 删除商品
export const ASSESS_REPLY_ASSESS = (reply, assessGoodsId) =>
  $put(
    `/store-platform/assess/replyAssess?reply=${reply}&assessGoodsId=${assessGoodsId}`
  )

// 短信充值
export const MESSAGE_RECHARGE = (params) =>
  $post('/store-platform/pay/messageRecharge', params)

// 分页查询商城短信列表
export const FIND_STORE_MESSAGE_PAGE = (pageNo, pageSize) =>
  $post('/store-platform/storeMessage/findStoreMessagePage', {
    pageNo,
    pageSize
  })

// 分页查询商城短信模板列表
export const FIND_SHOP_GOODS_TEMPLATE_PAGE = (shopId, pageNo, pageSize) =>
  $post('/store-platform/storeMessage/findStoreMessageTemplatePage', {
    shopId,
    pageNo,
    pageSize
  })

// 查询商城短信详情
export const FIND_STORE_MESSAGE_INFO = (messageId) =>
  $get('/store-platform/storeMessage/findStoreMessageInfo', {
    messageId
  })

// 分页查询消息通知列表接口
export const FIND_MESSAGE_MOTIFY_PAGE_API = (params, pageNo, pageSize) =>
  $post('/store-platform/messageNotify/findMessageNotifyPageApi', params, {
    pageNo,
    pageSize
  })

// 后台分页查询商铺返佣记录
export const FIND_SHOP_REBATE_PAGE = (params, pageNo, pageSize) =>
  $post('/store-platform/shop/findShopRebatePage', params, {
    pageNo,
    pageSize
  })

// 分页查询实体店铺申请
export const FIND_SHOP_CHANGE_APPLY_PAGE_API = (params, pageNo, pageSize) =>
  $post('/store-platform/shop/findShopChangeApplyPageApi', params, {
    pageNo,
    pageSize
  })

// 分页查询店铺种类申请
export const FIND_SHOP_KIND_APPLY_PAGE_API = (params, pageNo, pageSize) =>
  $post('/store-platform/shopKindApply/findShopKindApplyPageApi', params, {
    pageNo,
    pageSize
  })

// 申请店铺变更
export const ADD_SHOP_CHANGE_APPLY_API = (params) =>
  $post('/store-platform/shop/addShopChangeApplyApi', params)

// 创建店铺种类申请
export const CREATE_SHOP_KIND_APPLY_API = (params) =>
  $post('/store-platform/shopKindApply/createShopKindApplyApi', params)

// 查询未读消息数量接口
export const MESAGE_NOTIFY_FIND_UNREAD_NUM_API = (shopId) =>
  $get('/store-platform/messageNotify/findUnreadNumApi', {
    shopId
  })

// 统计未读消息接口
export const MESAGE_NOTIFY_COUNT_UNREAD = (shopId) =>
  $get('/store-platform/messageNotify/countUnread', {
    shopId
  })

// 查询店铺配置信息接口
export const FIND_SHOP_CONFIG_API = (shopId) =>
  $get('/store-platform/shopConfig/findShopConfigApi', {
    shopId
  })

// 编辑店铺营销工具配置接口
export const UPDATE_SHOP_MARKETING_API = (params) =>
  $put('/store-platform/shopConfig/updateShopMarketingApi', params)

// 查询商品类型列表
export const FIND_SHOP_PLATFORM_TYPE_LIST_API = (params) =>
  $post(
    '/store-platform/goodsPlatformType/findGoodsPlatformTypeListApi',
    params
  )

// 删除分销商品
export const DELETE_GOODS_DIS_API = (shopId, goodsNo) =>
  $delete(
    `/store-platform/goods/deleteGoodsDisApi?shopId=${shopId}&goodsNo=${goodsNo}`
  )

// 分页查询分销商品列表
export const FIND_GOODS_DIS_PAGE_API = (shopId, pageNo, pageSize) =>
  $post(
    `/store-platform/goods/findGoodsDisPageApi?shopId=${shopId}&pageNo=${pageNo}&pageSize=${pageSize}`
  )

// 创建分销商品
export const CREATE_GOODS_DIS_API = (shopId, goodsNo) =>
  $post(
    `/store-platform/goods/createGoodsDisApi?shopId=${shopId}&goodsNo=${goodsNo}`
  )

// 查看动态
export const FIND_DYNAMIC_INFO_LIST = (params, pageNo, pageSize) =>
  $post('/app-api/findDynamicInfoList', params, {
    pageNo,
    pageSize
  })

// 分页查询商品列表
export const UPDATE_GOODS_BATCH_API = (params) =>
  $put('/store-platform/goods/updateGoodsBatchApi', params)

// 查看APP-API的banner
export const FIND_DIS_HOMEPAGE_BANNER = (params) =>
  $post('/app-api/findBannerListByCondition', params)

// 2020年2月的新接口
// 分页展示进货圈商品
export const FIND_STOCK_GOODS_PAGE = (params, pageNo, pageSize) =>
  $post('/store-api/store/stock/findStockGoodsPage', params, {
    pageNo,
    pageSize
  })

// 查看单个商品详情接口
export const FIND_STOCK_GOODS_INFO = (goodsNo) =>
  $post(`/store-api/store/stock/findStockGoodsInfo?goodsNo=${goodsNo}`)

// 分销商一键进货
export const SET_ON_CILCK_STOCK = (params) =>
  $post('/store-api/store/stock/onClickStock', params)

// 查询进货运费
export const GET_STOCK_SHIPPING_FEE = (params) =>
  $post('/store-api/store/stock/getStockShippingFee', params)

// 创建供货商的订单
export const CREATE_PROVIDER_ORDER = (params) =>
  $post('/store-api/store/stock/createProviderOrder', params)

// 查询我的赊货锁额
export const FIND_MY_FROZEN_AMOUNT = (shopId) =>
  $post(`/store-api/store/stock/countMyFrozenAmount?shopId=${shopId}`)

// 后台分页查询店铺进货圈订单接口
export const FIND_STOCK_ORDER_PAGE_API = (params, pageNo, pageSize) =>
  $post('/store-api/store/stock/findStockOrderPageApi', params, {
    pageNo,
    pageSize
  })

// 分页查询用户的进货圈订单接口
export const FIND_STOCK_ORDER_PAGE = (params, pageNo, pageSize) =>
  $post('/store-api/store/stock/findStockOrderPage', params, {
    pageNo,
    pageSize
  })

// 查看进货圈订单详情接口
export const FIND_STOCK_ORDER_INFO = (orderNo) =>
  $post(`/store-api/store/stock/findStockOrderInfo?orderNo=${orderNo}`)

// 进货商确认收货改变订单状态接口（无运费）
export const CONFIRM_ORDER_STATE = (orderNo) =>
  $post(`/store-api/store/stock/confirmOrderState?orderNo=${orderNo}`)

// 确认收货完成订单（有运费）
export const CONFIRM_ORDER = (orderNo) =>
  $put(`/store-api/order/completeOrder?orderNo=${orderNo}`)

// 确认收货后，将进货商品添加至分销商商品列表
export const ADD_STOCK_GOODS_LIST = (orderNo) =>
  $post(`/store-api/store/stock/addStockGoodsList?orderNo=${orderNo}`)

// 查询物流
export const FIND_LOGISTICS_QUERY = (orderNo) =>
  $get(`/store-api/logistics/logisticsQuery?orderNo=${orderNo}`)

// 查询我的佣金额度
export const FIND_COUNT_MY_REBATE_AMOUNT = (shopId) =>
  $post(`/store-api/store/stock/countMyRebateAmount?shopId=${shopId}`)
// $post(`http://liyang.vipgz2.idcfengye.com/store-api/store/stock/countMyRebateAmount?shopId=${shopId}`)

// 查询我的赊货锁额
export const FIND_COUNT_MY_FROZEN_AMOUNT = (shopId) =>
  $post(`/store-api/store/stock/countMyFrozenAmount?shopId=${shopId}`)

// 供货商申请一键扣除分销商冻结余额
export const SUPPLIER_EXPEND_DIS = (params) =>
  $post('/store-api/store/stock/supplierExpendDis', params)

// 供货商添加进货圈商品
export const ADD_STOCK_GOODS_API = (params) =>
  $post('/store-api/store/stock/addStockGoodsApi', params)

// 批量上下架进货圈商品
export const UPDATE_GOODS_SHELF = (params) =>
  $post('/store-api/store/stock/updateGoodsShelf', params)

// 取消审核
export const CANCEL_GOODS_CHECK = (params, shopId) =>
  $post(`/store-api/store/stock/cancelGoodsCheck?shopId=${shopId}`, params)

// 分销商查看单个商品详情
export const FIND_MY_STOCK_GOODS_INFO = (goodsNo) =>
  $post(`/store-api/store/stock/findMyStockGoodsInfo?goodsNo=${goodsNo}`)

// 取消订单
export const CANCEL_ORDER_API = (orderNo) =>
  $post(`/store-api/store/stock/cancelOrderApi?orderNo=${orderNo}`)

// 批量上下架进货圈商品
export const CREATE_STOCK_SHOPPING_FEEPAY_ORDER = (params) =>
  $post('/store-api/pay/createStockShippingFeePayOrder', params)

// 分销商申请退款
export const CREATE_STOCKRE_FUND = (params) =>
  $post('/store-api/store/stock/createStockRefund', params)

// 分页查询退款记录
export const FIND_REFUD_PAGE = (params, pageNo, pageSize) =>
  $post('/store-api/refund/findRefundPage', params, {
    pageNo,
    pageSize
  })

// 编辑订单状态
export const UPDATE_ORDER_STATE = (params) =>
  $put('/store-api/order/updateOrderState', params)
